import type {
  FinalDefenseAddDTOType,
  FinalDefenseUpdateDTOType,
  FinalDefenseSearchDTOType
} from '@/resources/interface/finalDefense/FinalDefenseTypes'
import type { ResultTypes } from '@/resources/interface/ResultTypes'
import { HttpResultUtil } from '@/apis/utils/HttpResultUtil'
import type {
  MidtermDefenseAuditDTOType
} from '@/resources/interface/midtermDefense/MidtermDefenseTypes.ts'

export class FinalDefenseApi {
  private static addUrl: string = '/finalDefense/add'
  private static updateUrl: string = '/finalDefense/update'
  private static searchUrl: string = '/finalDefense/search'
  private static deleteUrl: string = '/finalDefense/delete'
  private static auditUrl: string = '/finalDefense/audit'

  static audit(data: MidtermDefenseAuditDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.auditUrl, data,true)
  }
  static add(data: FinalDefenseAddDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.addUrl, data,true)
  }

  static update(data: FinalDefenseUpdateDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.updateUrl, data,true)
  }

  static search(data: FinalDefenseSearchDTOType): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.searchUrl, data,false)
  }

  static delete(idList: Array<number>): Promise<ResultTypes> {
    return HttpResultUtil.awaitPost(this.deleteUrl, idList,true)
  }
}
